package com.swingson.other;

import com.swingson.event.ValueEvent;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.mvel2.compiler.ExecutableStatement;

/**
 * @author Dmitry
 */
public class ConditionAndAction {
    private final ExecutableStatement executableAccessor;
    private final ValueEvent event;
    private final Set<String> inputVariables = new HashSet<>();

    public ConditionAndAction(ExecutableStatement executableAccessor, ValueEvent event) {
        this.executableAccessor = executableAccessor;
        this.event = event;
    }

    public void addInputVariable(String variableName) {
        inputVariables.add(variableName);
    }

    public void addInputVariables(List<String> variableNameList) {
        inputVariables.addAll(variableNameList);
    }

    public boolean shouldProcess(String variableName) {
        return inputVariables.contains(variableName);
    }

    public ExecutableStatement getExecutableAccessor() {
        return executableAccessor;
    }

    public ValueEvent getEvent() {
        return event;
    }

}
